
Part-04: Bootstrap Admin Dashboard Template setup in School Management Software
Part 5: How to use AngularJS in ASP.NET MVC
Part-6: CRUD Operation Insert Data using AngularJS in ASP.NET MVC
Part-7: CRUD Operation & Load Data using AngularJS in ASP.NET MVC
Part-08: CRUD Operation Edit, Delete Data using Angularjs in ASP.NET MVC
Part-3: Create Database and Table in sql server for school management system
Part-09: Insert Section data using ASP.NET MVC AngularJs
Part-10: Edit Update and Delete Section data using Angular js | ASP.NET MVC | Jquery
Part-11: Cascading Dropdownlist Section Batch selection in asp.net MVC JQUERY AngularJS
Part-12: Insert & Delete course information for school management software using ASP.NET MVC Javascript Angularjs
Part-13: Create Update course info in ASP.NET MVC AngularJs JQUERY Javascript
Part-14: Insert data and Page design bootstrap using ASP.NET MVC JQUERY AngularJS
Part-15: Insert & Get data using store procedure in SQL Server ASP.NET MVC AngularJS JQUERY
Part-16: Load student list,bootstrap and Inactive using ASP.NET MVC AngularJS Jquery
Part-17: User authentication using Store procedure Javascript AngularJS JQUERY ASP.NET MVC
Part-18: User authentication, authorization and login using ASP.NET MVC AngularJS Javascript JQUERY
Part-19: User Registration & Insert semester Info using AngularJS in ASP.NET MVC
Part-20: Load semester info & Student course offer page design using ASP.NET MVC JQUERY Angularjs
Part-21: Course Offer Entry Using Jquery Multiple Data Save (Part-1) using ASP.NET MVC AngularJS
SMS-22: Student Course Offer Entry happens Using Jquery Multiple Data Save List view dropdownlist Load using Angular js in ASP.NET MVC
SMS-23: Student course offer list semester search using ASP.NET MVC AngularJS JQUERY
SMS-24: Student Marks Entry page in table column input marks entry using Jquery & Angular js in ASP.NET MVC
SMS-25: Student Course Mark multiple data save using jquery with Stored Procedure & Angular js in ASP.NET MVC
SMS-26: Student Marks list show by search student name and trimester Jquery & Angular js in ASP.NET MVC
SMS-27: Student profile create and browse profile using Store procedure AngularJS Jquery ASP.NET
SMS-28: Student Result show by search trimester and myasp server registration and login using Jquery & Angular js in ASP.NET MVC
This article will teach how to show list and Inactive student using ASP.NET MVC AngularJS Jquery. This will allow to learn about bootstrap design and fetch json data and set to javascript.
Steps:
Step-1: StudentList.cshtml page with writing the below code.
<div ng-app="ABCApp" ng-controller="StudentController">
<div class="content-wrapper">
<!-- Content Header (Page header) -->
<div class="content-header">
<div class="container-fluid">
<div class="row mb-2">
<div class="col-sm-6">
<h1 class="m-0 text-dark">Student List</h1>
</div><!-- /.col -->
<div class="col-sm-6">
<ol class="breadcrumb float-sm-right">
<li class="breadcrumb-item"><a href="../Student/StudentEntry">Add New Info</a></li>
</ol>
</div><!-- /.col -->
</div><!-- /.row -->
</div><!-- /.container-fluid -->
</div>
<!-- /.content-header -->
<!-- Main content -->
<section class="content">
<div class="container-fluid">
<div class="row">
<div class="col-md-4">
<div class="form-group">
<label>Batch Name</label>
<select class="form-control" ng-model="StudentDAO.BatchId" ng-change="LoadStudentListByBatchID(StudentDAO.BatchId)">
<option ng-repeat="e in Batch" value="{{e.BatchId}}">{{e.BatchName}}</option>
</select>
</div>
</div>
</div>
<div class="row">
<div class="col-md-12">
<table class="table table-responsive">
<tr>
<td>SL#</td>
<td>Student Id NO</td>
<td>Student Name</td>
<td>Batch Name</td>
<td>Section Name</td>
<td>Gender</td>
<td>Edit</td>
<td>Inactive</td>
</tr>
<tr ng-repeat="e in Student" ng-class-even="'even'" ng-class-odd="'odd'">
<td>{{e.SL}}</td>
<td>{{e.StudentIdNO}}</td>
<td>{{e.StudentName}}</td>
<td>{{e.BatchName}}</td>
<td>{{e.SectionName}}</td>
<td>{{e.Gender}}</td>
<td>
<a href="/Student/StudentEntry?MasterId={{e.StudentId}}" class="btn btn-warning">Edit</a>
</td>
<td><a ng-click="DeleteMAsterData(e.StudentId)" class="btn btn-danger">Inactive</a> </td>
</tr>
</table>
</div>
</div>
</div>
</section>
</div>
</div>
<script src="~/Scripts/angular.min.js"></script>
<script src="~/Scripts/AngularController/StudentControllerJS.js"></script>
Step-2:
- Add LoadStudentListByBatchID() in StudentControllerJS.js file.
- Go to Solution Explorer > Scripts Folder.> AngularController Folder> Create ‘StudentControllerJS.js> for Load Student Information with writing the below code.
$scope.LoadStudentListByBatchID = function (BatchId) {
$http.get("/Student/LoadData?BatchId=" + BatchId).then(function (d) {
$scope.Student = d.data;
}, function (error) {
alert("Faild");
});
};
Step-3:
- In StudentController.cs class add LoadData() JsonResult for Load Student Information.
- Go to Solution Explorer > Controllers Folder > StudentController.cs in this controller with writing the below code.
public JsonResult LoadData(int BatchId)
{
DataSet ds = aDal.LoadAllDataDAL(BatchId);
List<StudentDAO> lists = new List<StudentDAO>();
foreach (DataRow dr in ds.Tables[0].Rows)
{
lists.Add(new StudentDAO
{
StudentId = Convert.ToInt32(dr["StudentId"]),
SL = (dr["SL"].ToString()),
StudentIdNO = (dr["StudentIdNO"].ToString()),
StudentName = (dr["StudentName"].ToString()),
BatchName = (dr["BatchName"].ToString()),
SectionName = (dr["SectionName"].ToString()),
Gender = (dr["Gender"].ToString())
});
}
return Json(lists, JsonRequestBehavior.AllowGet);
}
Step-4:
- Add LoadAllDataDAL() in StudentDAL.cs class.
- Go to Solution Explorer > DAL Folder > StudentDAL.cs Class with writing the below code.
public DataSet LoadAllDataDAL(int BatchId)
{
SqlCommand com = new SqlCommand("sp_LoadAllData_Student", conn);
com.CommandType = CommandType.StoredProcedure;
com.Parameters.AddWithValue("@BatchId", BatchId);
SqlDataAdapter da = new SqlDataAdapter(com);
DataSet dss = new DataSet();
da.Fill(dss);
return dss;
}
Step-5:
- Create store Procedure for Section Name.
- Go to SQL Server 2014 > dbStudentMangeSystem database> Programmability> stored procedures> Select New> stored procedure>Create sp_LoadAllData_Student with writing the below code.
create proc [dbo].[sp_LoadAllData_Student]
@BatchId int
as
begin
select ROW_NUMBER() over (order by st.StudentId) as SL, ba.BatchName + st.StudentIdNO StudentIdNO, sec.SectionName, ba.BatchName, * from tblStudent as st
left join tblBatch ba on ba.BatchId=st.BatchId
left join tblSection sec on sec.SectionId=st.SectionId
where st.BatchId=@BatchId
end
Step-6:
- Add DeleteMAsterData() in StudentControllerJS.js file.
- Go to Solution Explorer > Scripts Folder.> AngularController Folder> Create ‘StudentControllerJS.js> for inactive Student Information with writing the below code.
$scope.DeleteMAsterData = function (StudentId) {
$http.get("/Student/StatusChangeStudentByMAsterId?StudentId=" + StudentId).then(function (d)
{
alert(d.data);
location.reload();
},
function (error) {
alert("Faild");
}
);
};
Step-7:
- In StudentController.cs class add StatusChangeStudentByMAsterId() JsonResult for Inactive Student Information.
- Go to Solution Explorer > Controllers Folder > StudentController.cs in this controller with writing the below code.
public JsonResult StatusChangeStudentByMAsterId(int StudentId)
{
string result = string.Empty;
try
{
aDal.DeleteInfoDAL(StudentId);
result = "Operation Deleted";
}
catch (Exception)
{
result = "Operation Faild";
//throw;
}
return Json(result, JsonRequestBehavior.AllowGet);
}
Step-8:
- Add DeleteInfoDAL() in StudentDAL.cs class.
- Go to Solution Explorer > DAL Folder > StudentDAL.cs Class with writing the below code.
public void DeleteInfoDAL(int StudentId)
{
SqlCommand com = new SqlCommand("Inactive_Student_ByMasterId", conn);
com.CommandType = CommandType.StoredProcedure;
com.Parameters.AddWithValue("@StudentId", StudentId);
conn.Open();
com.ExecuteNonQuery();
conn.Close();
}
Step-9:
- Create store Procedure for Section Name.
- Go to SQL Server 2014 > dbStudentMangeSystem database> Programmability> stored procedures> Select New> stored procedure>Create Inactive_Student_ByMasterId with writing the below code.
create proc [dbo].[Inactive_Student_ByMasterId]
@StudentId int
as
begin
update tblStudent set Status=0 where StudentId=@StudentId
end
Step-10: Run Application.